package com.haizhi.crm.biz.model;

import com.haizhi.crm.biz.constant.MessageStatus;
import com.haizhi.crm.common.model.BaseDo;
import lombok.Data;

import javax.persistence.*;

/**
 * Created by wangshan on 2018/5/16.
 */
@Data
@Entity
@Table(name = "ts_message_user" )
public class MessageUserDo extends BaseDo {

    @Column(name = "user_id" )
    private Long userId;

    @Column(name = "msg_id" )
    private Long msgId;

    @Column(name = "msg_status" )
    @Enumerated(EnumType.STRING)
    private MessageStatus status;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MessageUserDo that = (MessageUserDo) o;
        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        return msgId != null ? msgId.equals(that.msgId) : that.msgId == null;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (msgId != null ? msgId.hashCode() : 0);
        return result;
    }
}
